<!---

Kalendar Admin

COPYRIGHT & LICENSING INFO
-------------------------------------------------------------------

Copyright 2006 TJ Downes - tdownes@sanative.net - http://www.sanative.net

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  
FCKEditor COPYRIGHT & LICENSING INFO
-------------------------------------------------------------------
This product includes support for FCKEditor.
FCKEditor is developed by Frederico Caldeira Knabben. 
http://www.fckeditor.net/
FCKEditor is licensed under LGPL


DHTML Calendar COPYRIGHT & LICENSING INFO
-------------------------------------------------------------------
This product includes support and libraries for DHTML Calendar.
DHTML Calendar is developed by Mihai Bazon.
http://www.bazon.net/mishoo
DHTML Calendar is licensed under LPGL.

--->
<cfparam name="variables.formPassthrough" default="onfocus=""this.style.backgroundColor='##ffffff'"" onblur=""this.style.backgroundColor='##E6EEEE'""" />
<cfform action="#cgi.SCRIPT_NAME#" name="eventForm" method="post" onsubmit="return checkIt();">
<cfswitch expression="#appAction#">
	<cfcase value="addRecord">
	<input type="hidden" name="appAction" value="createRecord" />
	</cfcase>
	<cfcase value="editRecord">
	<input type="hidden" name="appAction" value="updateRecord" />
	</cfcase>
</cfswitch>
<input type="hidden" name="EventID" value="<cfoutput>#event.EventID#</cfoutput>" />
<table border="0" cellpadding="1" cellspacing="0" style="width:790px; border: 1px solid #768AA9; padding:21px;">
<tr>
	<td style="width:100px;">Event Title:</td>
	<td><cfif Left(Server.ColdFusion.ProductVersion, 1) lt 7><cfinput type="text" name="Title" value="#event.Title#" size="45" class="inputtextfield" required="true" message="Title is a required field." passthrough="#variables.formPassthrough#" /><cfelse><cfinput type="text" name="Title" value="#event.Title#" size="45" class="inputtextfield" required="true" validate="noblanks" message="Title is a required field." passthrough="#variables.formPassthrough#" /></cfif></td>
	<td>Category:</td>
	<td><cfselect name="CategoryID" query="returnedCategories" display="CategoryName" value="CategoryID" selected="#event.CategoryID#" /></td>
</tr>
<tr>
	<td style="width:100px;">&nbsp;</td>
	<td>&nbsp;</td>
	<td>New Category:</td>
	<td><cfinput type="text" name="NewCategoryName" size="21" class="inputtextfield" passthrough="#variables.formPassthrough#" /></td>
</tr>
<tr>
	<td colspan="4" style="padding-top:16px;"></td>
</tr>
<tr>
	<td>Start Date:</td>
	<td style="vertical-align: middle"><cfinput type="text" name="StartDate" value="#event.StartDate#" size="15" id="StartDate" class="inputtextfield" required="true" validate="date" message="Start Date is a required field and must be a valid date (m/d/yyyy format)." passthrough="#variables.formPassthrough#" /> <img src="../common/images/date.gif" id="StartDateImg" width="16" height="15" align="top" alt="start date chooser" /></td>
	<td>End Date:</td>
	<td style="vertical-align: middle"><cfinput type="text" name="EndDate" value="#event.EndDate#" size="15" class="inputtextfield" id="EndDate" required="false" validate="date" message="End Date must be a valid date (m/d/yyyy format)." passthrough="#variables.formPassthrough#" /> <img src="../common/images/date.gif" id="EndDateImg" width="16" height="15" align="top" alt="end date chooser" /></td>
</tr>
<tr>
	<td>Start Time:</td>
	<td><cfinput type="text" name="StartTime" value="#event.StartTime#" size="15" class="inputtextfield" required="false" validate="time" message="Start Time must be a valid time." passthrough="#variables.formPassthrough#" /></td>
	<td>End Time:</td>
	<td><cfinput type="text" name="EndTime" value="#event.EndTime#" size="15" class="inputtextfield" required="false" validate="time" message="End Time must be a valid time." passthrough="#variables.formPassthrough#" /></td>
</tr>
<tr>
	<td colspan="4" style="padding-top:16px;"></td>
</tr>
<tr>
	<td>Location:</td>
	<td><cfinput type="text" name="Location" value="#event.Location#" size="30" class="inputtextfield" passthrough="#variables.formPassthrough#" /></td>
	<td>Website:</td>
	<td><cfinput type="text" name="ExternalURL" value="#event.ExternalURL#" size="30" class="inputtextfield" passthrough="#variables.formPassthrough#" /></td>
</tr>
<tr>
	<td>Contact Name:</td>
	<td><cfinput type="text" name="ContactName" value="#event.ContactName#" size="30" class="inputtextfield" passthrough="#variables.formPassthrough#" /></td>
	<td>E-mail:</td>
	<td><cfif Left(Server.ColdFusion.ProductVersion, 1) lt 7><cfinput type="text" name="ContactEmail" value="#event.ContactEmail#" required="false" message="E-mail must be a valid e-mail address." size="30" class="inputtextfield" passthrough="#variables.formPassthrough#" /><cfelse><cfinput type="text" name="ContactEmail" value="#event.ContactEmail#" required="false" validate="email" message="E-mail must be a valid e-mail address." size="30" class="inputtextfield" passthrough="#variables.formPassthrough#" /></cfif></td>
</tr>
<tr>
	<td>Phone:</td>
	<td><cfinput type="text" name="ContactPhone" value="#event.ContactPhone#" size="15" class="inputtextfield" passthrough="#variables.formPassthrough#" /></td>
	<td colspan="2"><cfinput type="checkbox" name="IsPublished" value="1" checked="#YesNoFormat(event.IsPublished)#" /> Publish &nbsp; <cfinput type="checkbox" name="IsFeatured" value="1" checked="#YesNoFormat(event.IsFeatured)#" /> Featured</td>
</tr>
<tr>
	<td colspan="4" style="padding-top:16px;"></td>
</tr>
<tr>
	<td valign="top">Teaser:</td>
	<td colspan="3"><textarea name="Teaser" rows="0" cols="0" class="inputtextfield" style="width:99.5%; height:100px;" onfocus="this.style.backgroundColor='#ffffff'" onblur="this.style.backgroundColor='#E6EEEE'"><cfoutput>#event.Teaser#</cfoutput></textarea></td>
</tr>
<tr>
	<td valign="top">Body:</td>
	<td colspan="3">
	<cfif application.KConfig.getUseFCKEditor() is true>
		<cfscript>
			fckEditor = createObject("component", "#Replace(application.KConfig.getCFCPath(), '.', '/', 'ALL')#fckEditor");
				fckEditor.instanceName = "Description";
				fckEditor.value = Trim(event.Description);
				fckEditor.ToolBarSet = "EventDescription";
				fckEditor.basePath = "#application.KConfig.getFCKEditorRootPath()#";
				fckEditor.width = "100%";
				fckEditor.height = "300";
				// create instance now.
				fckEditor.create();
		</cfscript>
	<cfelse>
		<textarea name="Description" rows="0" cols="0" class="inputtextfield" style="width:99.5%; height:100px;" onfocus="this.style.backgroundColor='#ffffff'" onblur="this.style.backgroundColor='#E6EEEE'"><cfoutput>#event.Description#</cfoutput></textarea>
	</cfif>
	</td>
</tr>
<tr>
	<td valign="top">&nbsp;</td>
	<td colspan="3" align="center"><cfif NOT Compare(appAction, "addRecord")><input name="addRecord" type="submit" value="add record" class="button" /><cfelse><input name="deleteRecord" type="button" value="delete record" class="deletebutton" onClick="removeRecord();" />&nbsp;<input name="updateRecord" type="submit" value="update record" class="button" /></cfif></td>
</tr>
</table>
</cfform>
<!---	
		the following script defines the Calendar.setup helper function, which makes
   		adding a calendar a matter of 1 or 2 lines of code.
--->
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "StartDate",
        ifFormat       :    "%m/%d/%Y",
        button         :    "StartDateImg",
        align          :    "cc",
        singleClick    :    true
    });
    Calendar.setup({
        inputField     :    "EndDate",
        ifFormat       :    "%m/%d/%Y",
        button         :    "EndDateImg",
        align          :    "cc",
        singleClick    :    true
    });
</script>
